/*******************************************************************************
 * Copyright (c) 2002 Boris Pruessmann and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v0.5
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors:
 *    Boris Pruessmann - Initial implementation.
 ******************************************************************************/
package net.sourceforge.perforce.core.internal.events;

import net.sourceforge.perforce.core.syncinfo.IResourceStateDelta;
import net.sourceforge.perforce.core.syncinfo.ResourceSyncInfo;
import org.eclipse.core.resources.IResource;

/**
  * @version $Revision: 67 $
  * @author  <a href="mailto:bpruessmann@users.sourceforge.net">Boris Pruessmann</a>
  */
public class ResourceStateDelta implements IResourceStateDelta 
{
	// --------------------------------------------------------------------------- Private Variables
	
	/** Stores the handle to the resource. */
	private IResource resource;
	/** Stores the handle to the old ResourceSyncInfo. */
	private ResourceSyncInfo oldResourceSyncInfo;
	/** Stores the reference to the new ResourceSyncInfo. */
	private ResourceSyncInfo newResourceSyncInfo;
	
	// ------------------------------------------------------------------------- Public Constructors
	
	/** Constructor for ResourceStateDelta. 
	  * 
	  * @param theResource the resource.
	  * @param oldSyncInfo the old ResourceSyncInfo.
	  * @param newSyncInfo the new ResourceSyncInfo.
	  */
	public ResourceStateDelta(
		IResource theResource, ResourceSyncInfo oldSyncInfo, ResourceSyncInfo newSyncInfo)
	{
		resource = theResource;
		oldResourceSyncInfo = (oldSyncInfo != ResourceSyncInfo.NULL_INFO) ? oldSyncInfo : null;
		newResourceSyncInfo = (newSyncInfo != ResourceSyncInfo.NULL_INFO) ? newSyncInfo : null;
	}
	
	// ------------------------------------------------------------------------------ Public Methods
	
	/** Returns the resource.
	  * 
	  * @return the resource.
	  */
	public IResource getResource() 
	{
		return resource;
	}
	
	/** Returns the new ResourceSyncInfo.
	  * 
	  * @return new ResourceSyncInfo.
	  */
	public ResourceSyncInfo getNewResourceSyncInfo() 
	{
		return newResourceSyncInfo;
	}

	/** Returns the oldResourceSyncInfo.
	  *  
	  * @return old ResourceSyncInfo
	  */
	public ResourceSyncInfo getOldResourceSyncInfo() 
	{
		return oldResourceSyncInfo;
	}
}
